﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using University.Workshop.Presenters.Expenses;
using University.Workshop.Presenters.Expenses.Read;

namespace University.Workshop.Presentation.Expenses
{
    /// <summary>
    /// Interaction logic for Read.xaml
    /// </summary>
    public partial class Read : Page, IReadExpenseView
    {
        PresenterReadExpense pReadExpense;

        public Read(Model.Expense ex)
        {
            InitializeComponent();
            pReadExpense = new PresenterReadExpense(this, ex);
        }

        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            App.Current.MainWindow.Title = "Ver Egreso";
        }

        public void SystemMessage(string MessageValue)
        {
            MessageBox.Show(App.Current.MainWindow, MessageValue, "Atencion!!!", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, MessageBoxOptions.RightAlign);
        }

        public void ErrorMessage(string MessageValue)
        {
            MessageBox.Show(App.Current.MainWindow, MessageValue, "Error!!!", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.RightAlign);
        }

        private void CancelBtn_Click_1(object sender, RoutedEventArgs e)
        {
            this.NavigationService.Navigate(new Expenses.SearchExpense());
        }
     

        #region IModifyExpenseView Members


        public DateTime SpendDate
        {
            set
            {
                //SpenDateDpk.Text = value.ToShortDateString();
                SpenDateLbl.Content = value.ToShortDateString();
            }
        }

        public decimal Price
        {
            set
            {
                decimal monto = value;
                //Math.Truncate(monto);
                int entero = Convert.ToInt32(monto);
                PrinceLbl.Content = entero.ToString();
            }
        }

        public int Item
        {
            set
            {
                ItemCbx.SelectedIndex = value;
            }
        }

        public int Amount
        {
            set
            {
                AmountLbl.Content = value.ToString();
            }
        }

        public string Description
        {
            set
            {
                DetailsTxt.Text = value;
            }
        }

        public string Receipt
        {
            set
            {
                ReceiptLbl.Content = value;
            }
        }

        #endregion

    }
}
